<?php
/**
 * 修正数据库时间API
 * Created by PhpStorm.
 * User: poptser
 * Email: poptser@foxmail.com
 * Date: 2016/9/23
 * Time: 9:02
 */
namespace SDXApi\Controller;

use Think\Controller;
use Think\Model;

class CorrectController extends Controller{

    public function index(){
        set_time_limit(0);

        $this->order_action();
        $this->order_info();
        $this->warehouse_deliver_order();
        $this->warehouse_deliver_group();
        $this->warehouse_diliveryman_log();
        $this->warehouse_deliver_region();
    }

    /**
     *修正 order_action 表数据
     */
    public function order_action(){
        $t1 = microtime(true);
        $data_id = M("order_action")->where("action_user LIKE '%——角色%'")->getField('action_id',true);
        $data_id_str = implode(",",$data_id);
        M("order_action")->where('action_id in('.$data_id_str.')')->setDec('log_time',28800);
        $t2 = microtime(true);
        echo '修改 order_action 表，耗时'.round($t2-$t1,3).'秒<br/>';
    }
    /**
     *修正 order_info 表数据
     */
    public function order_info(){
        $t1 = microtime(true);
        $data_id = M("order_action")->where("action_user LIKE '%——角色%'")->getField('order_id',true);
        $data_id_str = implode(",",$data_id);
        M("order_info")->where('order_id in('.$data_id_str.') AND shipping_time>0')->setDec('shipping_time',28800);
        $t2 = microtime(true);
        echo '修改 order_info 表，耗时'.round($t2-$t1,3).'秒<br/>';
    }


    /**
     *修正 warehouse_deliver_order 表数据
     */
    public function warehouse_deliver_order(){
        $t1 = microtime(true);
        M("warehouse_deliver_order")->setDec('add_time',28800);
        M("warehouse_deliver_order")->setDec('order_paytime',28800);
        $t2 = microtime(true);
        echo '修改 warehouse_deliver_order 表，耗时'.round($t2-$t1,3).'秒<br/>';
    }

    /**
     *修正 warehouse_deliver_group 表数据
     */
    public function warehouse_deliver_group(){
        $t1 = microtime(true);
        M("warehouse_deliver_group")->setDec('create_time',28800);
        $t2 = microtime(true);
        echo '修改 warehouse_deliver_group 表，耗时'.round($t2-$t1,3).'秒<br/>';
    }

    /**
     *修正 warehouse_diliveryman_log 表数据
     */
    public function warehouse_diliveryman_log(){
        $t1 = microtime(true);
        M("warehouse_diliveryman_log")->setDec('add_time',28800);
        $t2 = microtime(true);
        echo '修改 warehouse_diliveryman_log 表，耗时'.round($t2-$t1,3).'秒<br/>';
    }
    /**
     *修正 warehouse_deliver_region 表数据
     */
    public function warehouse_deliver_region(){
        $t1 = microtime(true);
        M("warehouse_deliver_region")->setDec('add_time',28800);
        M("warehouse_deliver_region")->setDec('update_time',28800);
        $t2 = microtime(true);
        echo '修改 warehouse_deliver_region 表，耗时'.round($t2-$t1,3).'秒<br/>';
    }
}